<template>
  <div>
    <el-descriptions :column="1" title="指导记录" border>
      <el-descriptions-item label="发布日期">
        {{ list.direct_date | formatData }}
      </el-descriptions-item>
      <el-descriptions-item label="来源">
        {{ list.direct_from }}
      </el-descriptions-item>
      <el-descriptions-item label="进展">
        {{ list.direct_progress }}
      </el-descriptions-item>
      <el-descriptions-item label="内容">
        {{ list.direct_desc }}
      </el-descriptions-item>
      <el-descriptions-item label="评价">
        {{ list.direct_comment }}
      </el-descriptions-item>
    </el-descriptions>
    <el-button @click="goback">返回上一级</el-button>
  </div>
</template>
<script>
export default {
  created() {
    this.getdirect();
  },
  data() {
    return {
      list: {},
    };
  },
  filters: {
    formatData(time, arg) {
      return new Date(time).toLocaleString();
    },
  },
  methods: {
    getdirect() {
      const n = window.location.hash.substring(17);
      console.log(n);
      this.$http
        .get("http://127.0.0.1:8080/my/show_direct?id=" + n)
        .then((res) => {
          // console.log(res);
          if (res.data.status == 0) {
            this.list = res.data.data[0];
          } else {
            this.list = {};
          }
        });
    },
    goback() {
      this.$router.go(-1);
    },
  },
};
</script>
<style lang="less" scoped>
.el-button {
  float: right;
  margin: 20px 0;
}
</style>
